home *** CD-ROM | disk | FTP | other *** search
/ Sports Illustrated for Kids - Awesome Athletes! / Sports Illustrated for Kids - Awesome Athletes!.iso / ma.dir / 00015_movie script01.ls < prev    next >
Encoding:
Text File  |  1996-04-18  |  22.6 KB  |  685 lines

  1. on MAmovie
  2.   global MAmenuList, MAnewGame, MASavedList, gHSState, gMAnextLev, gMAmenu, gMAgameMarker, gMALev, gMAsound, gMAflip, MAflavor
  3.   set MAmenuList to [[#menu1a, #menu2a, #menu3a], [#menu1b, #menu2b, #menu3b], [#menu1c, #menu2c, #menu3c], [#menu1d, #menu2d, #menu3d]]
  4.   set the keyDownScript to "MAcheckKey"
  5.   set the text of cast "guessField" to " "
  6.   set the textSize of field "guessField" to 12
  7.   set the text of cast "guessField" to EMPTY
  8.   set MASavedList to []
  9.   set gHSState to [:]
  10.   set temp to HSStateGet("MA", "savedList")
  11.   set MASavedList to value(temp)
  12.   if listp(MASavedList) = 0 then
  13.     set MAnewGame to 1
  14.     set gMAgameMarker to 0
  15.     set gMALev to 1
  16.     set gMAnextLev to 1
  17.     set gMAsound to 1
  18.     set gMAflip to 1
  19.     set MAflavor to getAt(MAmenuList, 1)
  20.     set gMAmenu to the number of cast "menu1a"
  21.     MAinitGame()
  22.   end if
  23.   if listp(MASavedList) = 1 then
  24.     MAgetStates()
  25.     MAinitGame()
  26.   end if
  27. end
  28.  
  29. on MAdoConButtons
  30.   global gMAmenu, gMAcurrAth, gMAsound, gMAflip, gMALev, MAflavor, gMAnextLev, MAclearedGrid
  31.   repeat while (the mouseH > 0) and (the mouseH < 640) and (the mouseV < 16)
  32.     if (the mouseH > 0) and (the mouseH < 640) and (the mouseV < 16) then
  33.       set the castNum of sprite 44 to gMAmenu
  34.     end if
  35.     repeat while (the mouseH > 0) and (the mouseH < 102) and (the mouseV < 16)
  36.       if (the mouseH > 0) and (the mouseH < 102) and (the mouseV < 16) then
  37.         set the castNum of sprite 45 to the number of cast "how-hi.btn"
  38.       end if
  39.       updateStage()
  40.       if the mouseDown then
  41.         set the castNum of sprite 44 to the number of cast "menubar.blank"
  42.         puppetSprite(46, 1)
  43.         set the castNum of sprite 46 to the number of cast "hi.flag"
  44.         exit repeat
  45.       end if
  46.     end repeat
  47.     repeat while (the mouseH > 115) and (the mouseH < 205) and (the mouseV < 16)
  48.       if (the mouseH > 115) and (the mouseH < 205) and (the mouseV < 16) then
  49.         set the castNum of sprite 45 to the number of cast "new puz-hi.btn"
  50.       end if
  51.       updateStage()
  52.       if the mouseDown then
  53.         set the castNum of sprite 44 to the number of cast "menubar.blank"
  54.         set the text of cast "guessField" to EMPTY
  55.         MAinitGame()
  56.         goSetUp(1)
  57.         setUpCards(1)
  58.         exit repeat
  59.       end if
  60.     end repeat
  61.     repeat while (the mouseH > 225) and (the mouseH < 315) and (the mouseV < 16)
  62.       if (the mouseH > 225) and (the mouseH < 315) and (the mouseV < 16) then
  63.         set the castNum of sprite 45 to the number of cast "solve-hi.btn"
  64.       end if
  65.       updateStage()
  66.       if the mouseDown then
  67.         set the castNum of sprite 44 to the number of cast "menubar.blank"
  68.         puppetSprite(40, 1)
  69.         set the text of cast "guessField" to gMAcurrAth
  70.         repeat with I = 16 to 39
  71.           puppetSprite(I, 0)
  72.         end repeat
  73.         set MAclearedGrid to list(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
  74.         MAshowLetters()
  75.         MAdoHistory()
  76.         exit repeat
  77.       end if
  78.     end repeat
  79.     repeat while (the mouseH > 330) and (the mouseH < 420) and (the mouseV < 16) and (the mouseDown = 0)
  80.       if gMAnextLev = 1 then
  81.         if (the mouseH > 330) and (the mouseH < 420) and (the mouseV < 16) then
  82.           set the castNum of sprite 45 to the number of cast "lev01-hi.btn"
  83.         end if
  84.         updateStage()
  85.       end if
  86.       if gMAnextLev = 2 then
  87.         if (the mouseH > 330) and (the mouseH < 420) and (the mouseV < 16) then
  88.           set the castNum of sprite 45 to the number of cast "lev02-hi.btn"
  89.         end if
  90.         updateStage()
  91.       end if
  92.       if gMAnextLev = 3 then
  93.         if (the mouseH > 330) and (the mouseH < 420) and (the mouseV < 16) then
  94.           set the castNum of sprite 45 to the number of cast "lev03-hi.btn"
  95.         end if
  96.         updateStage()
  97.       end if
  98.       if the mouseDown then
  99.         set gMAnextLev to gMAnextLev + 1
  100.         if gMAnextLev > 3 then
  101.           set gMAnextLev to 1
  102.         end if
  103.         set gMAmenu to the number of cast string(getAt(MAflavor, gMAnextLev))
  104.         if gMALev = 10 then
  105.           set gMALev to 2
  106.           set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  107.           exit repeat
  108.         end if
  109.         if gMALev = 20 then
  110.           set gMALev to 3
  111.           set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  112.           exit repeat
  113.         end if
  114.         if gMALev = 30 then
  115.           set gMALev to 1
  116.           set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  117.           exit repeat
  118.         end if
  119.         updateStage()
  120.       end if
  121.     end repeat
  122.     repeat while (the mouseH > 435) and (the mouseH < 530) and (the mouseV < 16) and (the mouseDown = 0)
  123.       if gMAsound = 1 then
  124.         if (the mouseH > 435) and (the mouseH < 530) and (the mouseV < 16) then
  125.           set the castNum of sprite 45 to the number of cast "sound on-hi.btn"
  126.         end if
  127.       end if
  128.       if gMAsound = 0 then
  129.         if (the mouseH > 435) and (the mouseH < 530) and (the mouseV < 16) then
  130.           set the castNum of sprite 45 to the number of cast "sound off-hi.btn"
  131.         end if
  132.       end if
  133.       updateStage()
  134.       if the mouseDown then
  135.         if gMAsound = 1 then
  136.           set gMAsound to 0
  137.           set the soundEnabled to 0
  138.           if gMAflip = 1 then
  139.             set MAflavor to getAt(MAmenuList, 2)
  140.             set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  141.             exit repeat
  142.           end if
  143.           if gMAflip = 0 then
  144.             set MAflavor to getAt(MAmenuList, 4)
  145.             set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  146.             exit repeat
  147.           end if
  148.         end if
  149.         if gMAsound = 0 then
  150.           set gMAsound to 1
  151.           set the soundEnabled to 1
  152.           if gMAflip = 1 then
  153.             set MAflavor to getAt(MAmenuList, 1)
  154.             set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  155.             exit repeat
  156.           end if
  157.           if gMAflip = 0 then
  158.             set MAflavor to getAt(MAmenuList, 3)
  159.             set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  160.             exit repeat
  161.           end if
  162.         end if
  163.         updateStage()
  164.       end if
  165.     end repeat
  166.     repeat while (the mouseH > 540) and (the mouseH < 640) and (the mouseV < 16) and (the mouseDown = 0)
  167.       if gMAflip = 1 then
  168.         if (the mouseH > 540) and (the mouseH < 640) and (the mouseV < 16) then
  169.           set the castNum of sprite 45 to the number of cast "flip on-hi.btn"
  170.         end if
  171.       end if
  172.       if gMAflip = 0 then
  173.         if (the mouseH > 540) and (the mouseH < 640) and (the mouseV < 16) then
  174.           set the castNum of sprite 45 to the number of cast "flip off-hi.btn"
  175.         end if
  176.       end if
  177.       updateStage()
  178.       if the mouseDown then
  179.         if gMAflip = 1 then
  180.           set gMAflip to 0
  181.           if gMAsound = 1 then
  182.             set MAflavor to getAt(MAmenuList, 3)
  183.             set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  184.             exit repeat
  185.           end if
  186.           if gMAsound = 0 then
  187.             set MAflavor to getAt(MAmenuList, 4)
  188.             set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  189.             exit repeat
  190.           end if
  191.         end if
  192.         if gMAflip = 0 then
  193.           set gMAflip to 1
  194.           if gMAsound = 1 then
  195.             set MAflavor to getAt(MAmenuList, 1)
  196.             set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  197.             exit repeat
  198.           end if
  199.           if gMAsound = 0 then
  200.             set MAflavor to getAt(MAmenuList, 2)
  201.             set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  202.             exit repeat
  203.           end if
  204.         end if
  205.         updateStage()
  206.       end if
  207.     end repeat
  208.   end repeat
  209.   repeat while (the mouseH > 0) and (the mouseH < 60) and (the mouseV > 420)
  210.     if (the mouseH > 0) and (the mouseH < 60) and (the mouseV > 420) then
  211.       set the castNum of sprite 41 to the number of cast "back-hi.btn"
  212.     end if
  213.     updateStage()
  214.     if the mouseDown then
  215.       MAleaveGame()
  216.       updateStage()
  217.     end if
  218.   end repeat
  219.   repeat while (the mouseH > 575) and (the mouseH < 630) and (the mouseV > 420)
  220.     if (the mouseH > 575) and (the mouseH < 630) and (the mouseV > 420) then
  221.       set the castNum of sprite 41 to the number of cast "si kids-hi.btn"
  222.     end if
  223.     if the mouseDown then
  224.       updateStage()
  225.     end if
  226.   end repeat
  227.   repeat while (the mouseH > 361) and (the mouseH < 455) and (the mouseV > 455)
  228.     if (the mouseH > 361) and (the mouseH < 455) and (the mouseV > 455) then
  229.       set the castNum of sprite 41 to the number of cast "guess-hi.btn"
  230.     end if
  231.     updateStage()
  232.     if the mouseDown then
  233.       MAdoGuess()
  234.       updateStage()
  235.     end if
  236.   end repeat
  237. end
  238.  
  239. on MAcheckKey
  240.   if (the key = RETURN) or (the key = ENTER) then
  241.     MAdoGuess()
  242.   end if
  243.   if (the text of cast "guessField" = RETURN) or (the text of cast "guessField" = ENTER) then
  244.     set the text of cast "guessField" to EMPTY
  245.   end if
  246. end
  247.  
  248. on MAdoGuess
  249.   global gMAcurrAth, gMAgameMarker, MAclearedGrid
  250.   if the text of cast "guessField" = gMAcurrAth then
  251.     set gMAgameMarker to gMAgameMarker + 1
  252.     repeat with vMAi = 16 to 39
  253.       set the loc of sprite vMAi to point(-500, -500)
  254.       puppetSprite(vMAi, 0)
  255.     end repeat
  256.     set MAclearedGrid to list(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
  257.     MAshowLetters()
  258.     MAdoHistory()
  259.   else
  260.     beep()
  261.     set the selStart to 0
  262.     set the text of cast "guessField" to EMPTY
  263.     put EMPTY before char 1 of field "guessField"
  264.   end if
  265. end
  266.  
  267. on MAdoHistory
  268.   global gMAathStr
  269.   puppetSprite(42, 1)
  270.   puppetSprite(43, 1)
  271.   set the stretch of sprite 43 to 0
  272.   set the locH of sprite 42 to 320
  273.   set the locV of sprite 42 to 240
  274.   set the locH of sprite 43 to 200
  275.   set the locV of sprite 43 to 242
  276.   set the trails of sprite 43 to 1
  277.   set the castNum of sprite 43 to the number of cast string("HS" & gMAathStr & ".pct")
  278.   updateStage()
  279.   set the trails of sprite 43 to 0
  280.   set the locH of sprite 43 to 286
  281.   set the locV of sprite 43 to 170
  282.   set the castNum of sprite 43 to the number of cast string("MA" & gMAathStr)
  283.   updateStage()
  284. end
  285.  
  286. on MAtimer ticks
  287.   startTimer()
  288.   repeat while the timer < ticks
  289.     nothing()
  290.   end repeat
  291. end
  292.  
  293. on MAturnPuppets aMAlow, aMAhigh, aMAway
  294.   repeat with N = aMAlow to aMAhigh
  295.     puppetSprite(N, aMAway)
  296.   end repeat
  297. end
  298.  
  299. on MAturnVisible aMAlow, aMAhigh, aMAway
  300.   repeat with N = aMAlow to aMAhigh
  301.     MAturnPuppets(N, N, aMAway)
  302.     set the visible of sprite N to aMAway
  303.   end repeat
  304. end
  305.  
  306. on MAinitGame
  307.   global gMAnextLev, gMALev, MAgridList, gMAlowSprite, gMAhighSprite, gMAlowLetterSprite, gMAmatch, MAclearedGrid
  308.   if gMAnextLev > 0 then
  309.     set gMALev to gMAnextLev
  310.   else
  311.     set gMALev to 1
  312.   end if
  313.   MAallOFF()
  314.   doMAathList()
  315.   set MAgridList to [point(47, 113), point(125, 113), point(202, 113), point(280, 113), point(358, 113), point(436, 113), point(514, 113), point(592, 113), point(47, 226), point(125, 226), point(203, 226), point(281, 226), point(359, 226), point(437, 226), point(515, 226), point(593, 226), point(47, 339), point(125, 339), point(203, 339), point(281, 339), point(359, 339), point(437, 339), point(515, 339), point(593, 339)]
  316.   set gMAlowSprite to 16
  317.   set gMAhighSprite to 39
  318.   set gMAlowLetterSprite to 2
  319.   set gMAmatch to EMPTY
  320.   set MAclearedGrid to list()
  321.   repeat with N = 1 to 24
  322.     append(MAclearedGrid, 1)
  323.   end repeat
  324.   MAdoAnimList()
  325. end
  326.  
  327. on MAsetTile aMAwhichTile, aMAwhatNum
  328.   global gMAlowSprite, MAgridList
  329.   puppetSprite(aMAwhichTile + gMAlowSprite - 1, 1)
  330.   set the castNum of sprite (aMAwhichTile + gMAlowSprite - 1) to cast aMAwhatNum
  331.   set the loc of sprite (aMAwhichTile + gMAlowSprite - 1) to getAt(MAgridList, aMAwhichTile)
  332. end
  333.  
  334. on MAunCover aMAwhichOne, aMAcolor
  335.   global gMAmatch, gMAlowSprite, gMAoldOne, MAanswergridList, MAclearedGrid, gOldvRot, gMAflip, MAanimList
  336.   set aMAplaceOnGrid to aMAwhichOne - gMAlowSprite + 1
  337.   MAdoAnim(aMAplaceOnGrid, aMAcolor, 0)
  338.   if gMAmatch = EMPTY then
  339.     set gMAmatch to getAt(MArandomGridlist, aMAplaceOnGrid)
  340.     set gMAoldOne to aMAwhichOne
  341.     set gOldvRot to integer(aMAcolor)
  342.   else
  343.     MAtimer(40)
  344.     set aMAright to MAcheckMatch(getAt(MArandomGridlist, aMAplaceOnGrid), gMAmatch)
  345.     if aMAright = 1 then
  346.       setAt(MAclearedGrid, aMAwhichOne - gMAlowSprite + 1, 0)
  347.       setAt(MAclearedGrid, gMAoldOne - gMAlowSprite + 1, 0)
  348.       MAshowLetters()
  349.       if the castNum of sprite 1 = 8 then
  350.         set the castNum of sprite 1 to 13
  351.       else
  352.         set the castNum of sprite 1 to 8
  353.       end if
  354.       updateStage()
  355.       set the locH of sprite aMAwhichOne to -2000
  356.       set the locH of sprite gMAoldOne to -2000
  357.     else
  358.       put aMAcolor
  359.       MAdoAnim(aMAplaceOnGrid, aMAcolor, 1)
  360.       set vRot to integer(aMAcolor)
  361.       MAsetTile(aMAwhichOne - gMAlowSprite + 1, getAt(getAt(MAanimList, vRot), 1))
  362.       put aMAcolor
  363.       MAdoAnim(gMAoldOne - gMAlowSprite + 1, aMAcolor, 1)
  364.       MAsetTile(gMAoldOne - gMAlowSprite + 1, getAt(getAt(MAanimList, gOldvRot), 1))
  365.       put aMAcolor
  366.     end if
  367.     set gMAmatch to EMPTY
  368.   end if
  369. end
  370.  
  371. on MAdoAnim aMAwhere, aMAwhichColor, aMAbackward
  372.   global MAanswergridList, MAanimList, gMAlowSprite, gMAflip
  373.   if gMAflip = 1 then
  374.     if aMAbackward = 1 then
  375.       repeat with N = 6 down to 2
  376.         MAsetTile(aMAwhere, getAt(getAt(MAanimList, aMAwhichColor), N))
  377.         updateStage()
  378.         MAtimer(3)
  379.       end repeat
  380.     else
  381.       repeat with N = 1 to 6
  382.         MAsetTile(aMAwhere, getAt(getAt(MAanimList, aMAwhichColor), N))
  383.         updateStage()
  384.         MAtimer(5)
  385.       end repeat
  386.       set the trails of sprite (aMAwhere + gMAlowSprite - 1) to 1
  387.       MAsetTile(aMAwhere, getAt(getAt(MAanimList, aMAwhichColor), 7))
  388.       updateStage()
  389.       MAsetTile(aMAwhere, getProp(MAuniqueIconList, getaProp(MAanswergridList, aMAwhere)))
  390.     end if
  391.     set the trails of sprite (aMAwhere + gMAlowSprite - 1) to 0
  392.     updateStage()
  393.   end if
  394.   if gMAflip = 0 then
  395.     set the trails of sprite (aMAwhere + gMAlowSprite - 1) to 1
  396.     MAsetTile(aMAwhere, getAt(getAt(MAanimList, aMAwhichColor), 7))
  397.     updateStage()
  398.     MAsetTile(aMAwhere, getProp(MAuniqueIconList, getaProp(MAanswergridList, aMAwhere)))
  399.     set the trails of sprite (aMAwhere + gMAlowSprite - 1) to 0
  400.     updateStage()
  401.   end if
  402. end
  403.  
  404. on MAcheckMatch aMAisThis, aMAthis
  405.   set aMAright to 0
  406.   if aMAisThis = aMAthis then
  407.     set aMAright to 1
  408.   else
  409.     beep()
  410.     set aMAright to 0
  411.   end if
  412.   return aMAright
  413. end
  414.  
  415. on MAshowLetters
  416.   global gMAcurrAth, MAanswergridList, MAclearedGrid, gMAlowLetterSprite, gMAcurNameLength, gMALev, gMAblanks, gMAspacelessName
  417.   repeat with N = 1 to 24
  418.     if getAt(MAclearedGrid, N) = 0 then
  419.       repeat with X = 1 to gMAcurNameLength + gMAblanks
  420.         if gMALev <> 2 then
  421.           if char X of gMAcurrAth = string(getAt(MAanswergridList, N)) then
  422.             if gMALev < 3 then
  423.               puppetSprite(X + gMAlowLetterSprite - 1, 1)
  424.               set the castNum of sprite (X + gMAlowLetterSprite - 1) to cast getAt(MAanswergridList, N)
  425.             end if
  426.             if gMALev > 2 then
  427.               set the loc of sprite (X + gMAlowLetterSprite - 1) to point(5 + (X * 33), 459)
  428.             end if
  429.           end if
  430.         end if
  431.         if gMALev = 2 then
  432.           if char X of gMAspacelessName = string(getAt(MAanswergridList, N)) then
  433.             puppetSprite(X + gMAlowLetterSprite - 1, 1)
  434.             set the castNum of sprite (X + gMAlowLetterSprite - 1) to cast getAt(MAanswergridList, N)
  435.           end if
  436.         end if
  437.       end repeat
  438.     end if
  439.   end repeat
  440. end
  441.  
  442. on makeAnswerGridList fromWhatList
  443.   global MAuniqueIconList
  444.   set thisList to list()
  445.   repeat with N = 1 to 24
  446.     if getAt(fromWhatList, N) > 0 then
  447.       append(thisList, string(getPropAt(MAuniqueIconList, getAt(fromWhatList, N))))
  448.       next repeat
  449.     end if
  450.     append(thisList, 0)
  451.   end repeat
  452.   return thisList
  453. end
  454.  
  455. on makeRandomGrid withHowMany
  456.   set usedList to [:]
  457.   repeat with N = 1 to 24
  458.     addProp(usedList, N, 0)
  459.   end repeat
  460.   set N to 1
  461.   repeat while N < (withHowMany + 1)
  462.     set try to EMPTY
  463.     repeat while try = EMPTY
  464.       set try to random(24)
  465.       if getAt(usedList, try) = 0 then
  466.         setAt(usedList, try, N)
  467.         set try to EMPTY
  468.         repeat while try = EMPTY
  469.           set try to random(24)
  470.           if getAt(usedList, try) = 0 then
  471.             setAt(usedList, try, N)
  472.             set N to N + 1
  473.             next repeat
  474.           end if
  475.           set try to EMPTY
  476.         end repeat
  477.         next repeat
  478.       end if
  479.       set try to EMPTY
  480.     end repeat
  481.   end repeat
  482.   return usedList
  483. end
  484.  
  485. on MAallOFF
  486.   MAturnPuppets(1, 48, 1)
  487.   MAturnVisible(1, 48, 1)
  488.   MAturnPuppets(1, 48, 0)
  489. end
  490.  
  491. on tellLoc
  492.   repeat with N = 16 to 39
  493.     put the loc of sprite N
  494.   end repeat
  495. end
  496.  
  497. on goSetUp MAnewGame
  498.   global MAgridList, gMAlowSprite, gMAlowLetterSprite, gMAcurrAth, MAathList, MAunusedAthList, gMAcurNameLength, gMAblanks, gMAcurrAthNum, MAuniqCharList, gMAspacelessName, MAflavor, MAmenuList, mouseUp, gMAnextLev, gMAathStr, mouseUp, gMALev
  499.   set gMALev to gMAnextLev
  500.   if MAnewGame = 1 then
  501.     set MAunusedAthList to value(string(MAathList))
  502.     set N to count(MAunusedAthList)
  503.     set vMArandomAthlete to random(N)
  504.     set gMAcurrAth to getPropAt(MAunusedAthList, vMArandomAthlete)
  505.     set gMAcurrAthNum to getAt(MAunusedAthList, vMArandomAthlete)
  506.     set MAflavor to getAt(MAmenuList, 1)
  507.   end if
  508.   set gMAspacelessName to gMAcurrAth
  509.   repeat with I = 1 to length(gMAspacelessName)
  510.     if char I of gMAspacelessName = " " then
  511.       delete char I of gMAspacelessName
  512.     end if
  513.   end repeat
  514.   if gMALev = 2 then
  515.     set vMAname to gMAspacelessName
  516.     set vMAnum to length(gMAspacelessName)
  517.     set X to EMPTY
  518.     repeat with I = 1 to length(gMAspacelessName)
  519.       set N to random(vMAnum)
  520.       set X to char N of vMAname
  521.       delete char N of vMAname
  522.       set vMAscrambledName to string(vMAscrambledName & X)
  523.       set vMAnum to vMAnum - 1
  524.     end repeat
  525.     set gMAspacelessName to vMAscrambledName
  526.   end if
  527.   set gMAathStr to string(gMAcurrAthNum)
  528.   if length(gMAathStr) < 3 then
  529.     set gMAathStr to string("0" & gMAcurrAthNum)
  530.   end if
  531.   if gMALev <> 2 then
  532.     set theChar to char 1 of gMAcurrAth
  533.     set N to 1
  534.     set vMAblankCount to 0
  535.     repeat while theChar <> EMPTY
  536.       puppetSprite(N + gMAlowLetterSprite - 1, 1)
  537.       if char N of gMAcurrAth = " " then
  538.         set the castNum of sprite (N + gMAlowLetterSprite - 1) to cast string("blank")
  539.         set vMAblankCount to vMAblankCount + 1
  540.       else
  541.         set the castNum of sprite (N + gMAlowLetterSprite - 1) to cast string("dash")
  542.       end if
  543.       if gMALev < 2 then
  544.         set the loc of sprite (N + gMAlowLetterSprite - 1) to point(5 + (N * 33), 459)
  545.       end if
  546.       if gMALev > 2 then
  547.         set the loc of sprite (N + gMAlowLetterSprite - 1) to point(5 + (N * 33), 1000)
  548.       end if
  549.       set N to N + 1
  550.       set theChar to char N of gMAcurrAth
  551.     end repeat
  552.   end if
  553.   if gMALev = 2 then
  554.     set theChar to char 1 of gMAspacelessName
  555.     set N to 1
  556.     set vMAblankCount to 0
  557.     repeat while theChar <> EMPTY
  558.       puppetSprite(N + gMAlowLetterSprite - 1, 1)
  559.       set the castNum of sprite (N + gMAlowLetterSprite - 1) to cast string("dash")
  560.       set the loc of sprite (N + gMAlowLetterSprite - 1) to point(5 + (N * 33), 459)
  561.       set N to N + 1
  562.       set theChar to char N of gMAspacelessName
  563.     end repeat
  564.   end if
  565.   set gMAcurNameLength to N - 1 - vMAblankCount
  566.   set gMAblanks to vMAblankCount
  567. end
  568.  
  569. on setUpCards MAnewGame
  570.   global uniquePairList, MAuniqueIconList, gMAcurNameLength, MArandomGridlist, MAanswergridList, MAclearedGrid, MAcharList, gMAcurrAth, gMAspacelessName, gMALev, MAuniqCharList
  571.   if MAnewGame = 1 then
  572.     set MAcharList to []
  573.     set vMAcharNums to length(gMAspacelessName)
  574.     repeat with vMAi = 1 to vMAcharNums
  575.       append(MAcharList, char vMAi of gMAspacelessName)
  576.     end repeat
  577.     set vMAnum to length(gMAspacelessName)
  578.     set MAuniqCharList to []
  579.     repeat with vMAi = 1 to vMAnum
  580.       set vChr to char vMAi of gMAspacelessName
  581.       set vFlag to 1
  582.       repeat with vMAn = vMAi - 1 down to 1
  583.         if vChr = char vMAn of gMAspacelessName then
  584.           set vFlag to 0
  585.           exit repeat
  586.         end if
  587.       end repeat
  588.       if vFlag then
  589.         add(MAuniqCharList, vChr)
  590.       end if
  591.     end repeat
  592.     MAdoUniqueIconList()
  593.     set MArandomGridlist to makeRandomGrid(count(MAuniqueIconList))
  594.     set MAanswergridList to makeAnswerGridList(MArandomGridlist)
  595.   end if
  596.   repeat with N = 1 to count(MAuniqueIconList)
  597.     set a to 0
  598.     set X to 0
  599.     repeat while a = 0
  600.       set X to X + 1
  601.       set a to getAt(MArandomGridlist, X)
  602.       if a = N then
  603.         set a to X
  604.         next repeat
  605.       end if
  606.       set a to 0
  607.     end repeat
  608.     set b to 0
  609.     repeat while b = 0
  610.       set X to X + 1
  611.       set b to getAt(MArandomGridlist, X)
  612.       if b = N then
  613.         set b to X
  614.         next repeat
  615.       end if
  616.       set b to 0
  617.     end repeat
  618.     if getAt(MAclearedGrid, a) = 1 then
  619.       set num to getAt(getAt(MAanimList, integer(char 8 of the name of cast getAt(MAuniqueIconList, N))), 1)
  620.       MAsetTile(a, num)
  621.       MAsetTile(b, num)
  622.     end if
  623.   end repeat
  624. end
  625.  
  626. on MAputStates
  627.   global MASavedList, gMAmenu, MAflavor, gMALev, gMAflip, gMAsound, gMAcurrAth, gMAcurrAthNum, MAunusedAthList, MAuniqueIconList, MArandomGridlist, MAanswergridList, gMAgameMarker, MAnewGame
  628.   set MASavedList to []
  629.   setAt(MASavedList, 1, gMAmenu)
  630.   setAt(MASavedList, 2, MAflavor)
  631.   setAt(MASavedList, 3, gMALev)
  632.   setAt(MASavedList, 4, gMAflip)
  633.   setAt(MASavedList, 5, gMAsound)
  634.   setAt(MASavedList, 6, gMAcurrAth)
  635.   setAt(MASavedList, 7, gMAcurrAthNum)
  636.   setAt(MASavedList, 8, MAunusedAthList)
  637.   setAt(MASavedList, 9, MAuniqueIconList)
  638.   setAt(MASavedList, 10, MArandomGridlist)
  639.   setAt(MASavedList, 11, MAanswergridList)
  640.   setAt(MASavedList, 12, gMAgameMarker)
  641.   setAt(MASavedList, 13, MAnewGame)
  642. end
  643.  
  644. on MAgetStates
  645.   global MASavedList, MAnewGame, gMAmenu, MAflavor, gMALev, gMAflip, gMAsound, gMAcurrAth, gMAcurrAthNum, MAunusedAthList, MAuniqueIconList, MArandomGridlist, MAanswergridList, gMAgameMarker
  646.   set gMAmenu to getAt(MASavedList, 1)
  647.   set MAflavor to getAt(MASavedList, 2)
  648.   set gMALev to getAt(MASavedList, 3)
  649.   set gMAflip to getAt(MASavedList, 4)
  650.   set gMAsound to getAt(MASavedList, 5)
  651.   set gMAcurrAth to getAt(MASavedList, 6)
  652.   set gMAcurrAthNum to getAt(MASavedList, 7)
  653.   set MAunusedAthList to getAt(MASavedList, 8)
  654.   set MAuniqueIconList to getAt(MASavedList, 9)
  655.   set MArandomGridlist to getAt(MASavedList, 10)
  656.   set MAanswergridList to getAt(MASavedList, 11)
  657.   set gMAgameMarker to getAt(MASavedList, 12)
  658.   set MAnewGame to getAt(MASavedList, 13)
  659.   if MAnewGame = 0 then
  660.     MAresumeGame()
  661.   else
  662.     MAinitGame()
  663.   end if
  664. end
  665.  
  666. on MAleaveGame
  667.   global gMAmatch
  668.   MAallOFF()
  669.   set gMAmatch to EMPTY
  670.   MAputStates()
  671.   cleanUp()
  672. end
  673.  
  674. on MAresumeGame
  675.   go("gameFrame")
  676.   goSetUp(0)
  677.   setUpCards(0)
  678.   MAshowLetters()
  679. end
  680.  
  681. on cleanUp
  682.   global MASavedList
  683.   HSStatePut("MA", "savedList", string(MASavedList))
  684. end
  685.